
(function(window,document,Laya){
	var __un=Laya.un,__uns=Laya.uns,__static=Laya.static,__class=Laya.class,__getset=Laya.getset,__newvec=Laya.__newvec;
	//class laya.maker.sdk.LayaMakerSDK
	var LayaMakerSDK=(function(){
		function LayaMakerSDK(){};
		__class(LayaMakerSDK,'laya.maker.sdk.LayaMakerSDK');
		LayaMakerSDK.init=function(appId,isDebug,caller,callback){
			if (!LayaMakerSDK.inited){
				LayaMakerSDK.inited=true;
				LayaMakerSDK.initData.appId=appId;
				LayaMakerSDK.initData.isDebug=isDebug;
				LayaMakerSDK.moduleNameClassMap={};
				LayaMakerSDK.moduleNameClassMap['Base']=Base;
				LayaMakerSDK.moduleNameClassMap['Data']=Data;
				LayaMakerSDK.moduleMap={};
				callback.call(caller);
			}
		}

		LayaMakerSDK.getModule=function(moduleName){
			if (!LayaMakerSDK.moduleNameClassMap)return null;
			if (null==LayaMakerSDK.moduleNameClassMap[moduleName]){
				console.log('不存在的模块名:'+moduleName);
				return null;
			}
			if (null==LayaMakerSDK.moduleMap[moduleName]){
				LayaMakerSDK.moduleMap[moduleName]=new LayaMakerSDK.moduleNameClassMap[moduleName](LayaMakerSDK.initData);
			}
			return LayaMakerSDK.moduleMap[moduleName];
		}

		LayaMakerSDK.moduleMap=null
		LayaMakerSDK.moduleNameClassMap=null
		LayaMakerSDK.inited=false;
		LayaMakerSDK.initData={};
		return LayaMakerSDK;
	})()


	laya.maker.sdk.SDKWrapper.instance.setSDKProto(laya.maker.sdk.LayaMakerSDK);
	//class laya.maker.sdk.module.Base
	var Base=(function(){
		function Base(initData){
			this.sdk=null;
			this.sdk=window.SPSDK;
			this.sdk.init && this.sdk.init(initData);
		}

		__class(Base,'laya.maker.sdk.module.Base');
		var __proto=Base.prototype;
		__proto.login=function(caller,callback){
			this.sdk.login(this,function(data){
				callback.apply(caller,[data]);
			});
		}

		//});
		__proto.marketLogin=function(caller,callback){
			this.sdk.login('',function(data){
				var o={
					'code':data.result,
					'userid':data.data.userId,
					'token':data.data.sign+"."+data.data.time,
					'serverid':''
				};
				if (!data.data.sign || !data.data.time){
					o['code']=-2;
				}
				o.other=data.data;
				callback.apply(caller,[o]);
			});
		}

		__proto.onShow=function(data){
			this.sdk.onShow(data);
		}

		__proto.showVideoAd=function(adUnitId,callback){
			this.sdk.showRewardVideo(adUnitId,callback);
		}

		__proto.showBannerAd=function(adUnitId,style,destroy,callback){
			return this.sdk.showADBanner(adUnitId,style,destroy,callback);
		}

		__proto.hideBannerAd=function(adUnitId,callback){
			this.sdk.hideADBanner(adUnitId,callback);
		}

		__proto.share=function(shareInfo,callback){
			this.sdk.share(shareInfo,callback);
		}

		__proto.setShareInfo=function(shareInfo,callback){
			this.sdk.initShareInfo(shareInfo,callback);
		}

		__proto.reportData=function(key,value,callback){
			this.sdk.reportedGameData(key,value,callback);
		}

		__proto.getUserInfo=function(callback){
			this.sdk.getUserInfo(callback);
		}

		__proto.getUserOpenId=function(){
			return this.sdk.getUserOpenId();
		}

		__proto.postMessage=function(data){
			this.sdk.postMessage(data);
		}

		return Base;
	})()


	//class laya.maker.sdk.module.Data
	var Data=(function(){
		function Data(initData){
			this.sdk=null;
			this.sdk=window.SPSDK;
		}

		__class(Data,'laya.maker.sdk.module.Data');
		var __proto=Data.prototype;
		__proto.setUserData=function(key,val,caller,callback){
			this.sdk.setUserData(key,val,caller,callback);
		}

		__proto.getUserData=function(key,caller,callback){
			this.sdk.getUserData(key,caller,callback);
		}

		return Data;
	})()



})(window,document,Laya);
